Plotly - We are making interactive plots

Create a flexdashboard using plotly for that includes at least three distinct plot types (e.g. scatterplots, line plots, bar plots, box plots, etc.)

data(rest_inspec)

NYC_food =
  rest_inspec |> 
  select(boro, score,cuisine_description, grade, zipcode) |> 
  drop_na(score) |> 
  drop_na(grade) |>
  filter(
    boro == "MANHATTAN")

Make a scatterplot!

NYC_food |> 
  mutate(text_label = str_c("Grade: $", grade, "\nScore: ", score)) |> #\n: line break
  plot_ly(x = ~cuisine_description, y = ~score, color = ~zipcode, text = ~text_label,
          type = "scatter", mode = "markers")

Make a boxplot!

NYC_food |> 
  plot_ly(y = ~score, color = ~cuisine_description, 
          type = "box")

Make a barplot!

NYC_food |>
  count(cuisine_description) |> 
  mutate(cuisine_description = fct_reorder(cuisine_description, n)) |>
  plot_ly(x = ~cuisine_description, y = ~n, color = ~cuisine_description,
          type = "bar", colors = "viridis")